[ISSUE #401 #405] Support runtime API base URL configuration for Docker#415
Open
itxaiohanglover wants to merge 1 commit into
Open
[ISSUE #401 #405] Support runtime API base URL configuration for Docker#415itxaiohanglover wants to merge 1 commit into
itxaiohanglover wants to merge 1 commit into
Conversation
…ion for Docker The frontend API base URL was hardcoded at build time, causing issues when deploying via Docker (the built image always points to localhost:8082). This commit introduces a runtime configuration mechanism: - Add env-config.js loaded before React app, providing window.__ENV__ - Update remoteApi.js to check window.__ENV__.API_BASE_URL first - Add Docker entrypoint script that extracts and patches env-config.js when API_BASE_URL environment variable is set - Users can now set API_BASE_URL in docker-compose to configure the frontend at container startup without rebuilding This fixes both apache#401 (Docker localhost issue) and apache#405 (release API localhost:8082 issue).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fixes #401, fixes #405
The frontend API base URL was hardcoded at build time. When deployed via Docker, the built image always points to
localhost:8082, making it impossible to use the dashboard from other hosts without rebuilding.Brief changelog
env-config.jsloaded before React app, providingwindow.__ENV__.API_BASE_URLremoteApi.jsto check runtime config first, then build-time env var, thenwindow.location.originenv-config.jsat container startup whenAPI_BASE_URLenv var is setHow to use
When
API_BASE_URLis not set, the frontend defaults towindow.location.origin(same-origin), preserving backward compatibility.